public class Main {
    public void custmerA(int appleWeight,int strawberryWeight){
        Supermarket supermarket = new Supermarket();

        double totalPriceA = buyFruits(supermarket, "顾客A", new Fruit("苹果", 8.0,appleWeight), new Fruit("草莓", 13.0,strawberryWeight));
        System.out.println("顾客A购买水果的总价：" + totalPriceA);
    }

    public void custmerB(int appleWeight,int strawberryWeight,int mangoWeight){
        Supermarket supermarket = new Supermarket();

        double totalPriceB = buyFruits(supermarket, "顾客B", new Fruit("苹果", 8.0,appleWeight),new Fruit("草莓", 13.0,strawberryWeight),new Fruit("芒果", 20.0,mangoWeight));
        System.out.println("顾客B购买水果的总价：" + totalPriceB);
    }

    public void custmerC(int appleWeight,int strawberryWeight,int mangoWeight){
        Supermarket supermarket = new Supermarket();
        Fruit strawberryFruit = new Fruit("草莓", 13.0, strawberryWeight);
        strawberryFruit.setDiscountRate(0.8);
        double totalPriceC = buyFruits(supermarket, "顾客B", new Fruit("苹果", 8.0,appleWeight),strawberryFruit,new Fruit("芒果", 20.0,mangoWeight));
        System.out.println("顾客C购买水果的总价：" + totalPriceC);
    }

    public void custmerD(int appleWeight,int strawberryWeight,int mangoWeight){
        Supermarket supermarket = new Supermarket();
        supermarket.setDiscountAmount(10);

        Fruit strawberryFruit = new Fruit("草莓", 13.0, strawberryWeight);
        strawberryFruit.setDiscountRate(0.8);
        double totalPriceD = buyFruits(supermarket, "顾客B", new Fruit("苹果", 8.0,appleWeight),strawberryFruit,new Fruit("芒果", 20.0,mangoWeight));
        System.out.println("顾客D购买水果的总价：" + totalPriceD);
    }

    public static double buyFruits(Supermarket supermarket, String customerName, Fruit... fruits) {
        System.out.println(customerName + "购买的水果：");
        for (Fruit fruit : fruits) {
            supermarket.addFruit(fruit);
            System.out.println(fruit.getName());
        }
        double totalPrice = supermarket.calculateTotalPrice();
        System.out.println();
        return totalPrice;
    }
}